list_x = [1,0,1,0,1,0,1]
# filter中的lambda表达式一定要返回能代表真假的才可以达到过滤的效果
r = filter(lambda x: True if x ==1 else False,list_x)
c = filter(lambda x: x,list_x)

print(list(r))
print(list(c))